<include file="public:header" />
<include file="public:left" />
<style>
    td {
        text-align: center;
    }
</style>
<style type="text/css" src="__STATIC__/admin/css/style.css" ></style>
<style type="text/css" src="__STATIC__/admin/js/laydate/need/laydate.css" ></style>
<script src="__STATIC__/admin/js/laydate/laydate.js"></script>
<section>
    <div class="page_title">
        <h2 class="fl">抽奖人列表</h2>
        <a class="fr" href="{:url('Activity/lotteryer_add',['activity_id'=>$activity_id])}">抽奖人添加</a>
    </div>

    <table class="table">
        <tr>
            <th>操作</th>
            <th>id</th>
            <th>抽奖电话</th>
        </tr>
        <volist name="list" id="vo" key="k">
            <tr>
                <td><input type="checkbox" name="id_{$vo.id}" value="{$vo.id}"/></td>
                <td>
                    {$vo.id}
                </td>
                <td>
                    {$vo.mobile}
                </td>
            </tr>
        </volist>
    </table>
    <button type="button" class="link_btn" style="margin-bottom: 0px;margin-top: 10px">删除</button>
</section>
{$list->render()}
<!--tabStyle-->
<script>
$(".link_btn").click(function(){
    var id = new Array();
    var activity_id = "{$activity_id}";

    var i=0;
    $("input[name^='id']:checked").each(function(){
        var name_value = $(this).val();

        id[i] = name_value;
        i++;
    });
    
    var formData = new FormData();
        formData.append('ids',id);
        formData.append('activity_id',activity_id);

    $.ajax({
        url:"{:url('Activity/lotteryer')}",
        type:'POST',
        data:formData,
        async:false,
        processData:false,
        contentType:false,
        success:function(result){
            if(result.code == '0'){
                    layer.alert(result.msg);
            }else{
                layer.alert(result.msg, {
                            btn: ['确定']
                        },
                function (index, item) {
                    location.href = result.url;
                });
            }
        }
    });
});
</script>
</div>
</section>
</body>
</html>